home *** CD-ROM | disk | FTP | other *** search
- Path: rcp6.elan.af.mil!rscernix!danpop
- From: danpop@mail.cern.ch (Dan Pop)
- Newsgroups: comp.lang.c
- Subject: Re: accessing structures (newbie question)
- Date: 22 Feb 96 12:42:23 GMT
- Organization: CERN European Lab for Particle Physics
- Message-ID: <danpop.824992943@rscernix>
- References: <4g8gic$o6u@news1.sunbelt.net> <3128FA60.5227@metagen.co.uk> <TANMOY.96Feb19090845@qcd.lanl.gov> <4geju0$sif@maureen.teleport.com>
- NNTP-Posting-Host: ues5.cern.ch
- X-Newsreader: NN version 6.5.0 #7 (NOV)
-
- In <4geju0$sif@maureen.teleport.com> hksys@teleport.com (GHouck) writes:
-
- >tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) wrote:
- >[snip]
- >>What nonsense! Anything creates trouble if you do not take the time
- >>to understand it.
- >>
- >> I think you may have been using the wrong syntax when you tried the array
- >> method. The xth item is given by 'photos[x].' which is equivalent to
- >> '(photos + x * sizeof(picture))->'.
- >>
- >>This is the problem!!! photos[x]. is always the same as (photos + x)->
- >>In fact, this is such a basic fact of pointer arithmetic that anyone
- >>who posts such nonsense must surely be trying to deliberately mislead
- >>newbies. We have enough confusion here: please refrain from posting
- >>_answers_ unless you know at least the basics of C!
- >>
- >Tanmoy,
- >
- >Speaking of nonsense (your word), what is the meaning of your statement:
- >
- >> '(photos + x * sizeof(picture))->'. ?
- >
- >It may make sense conceptually, but syntactically you will step thru
- >the array of structures rather quickly (by a factor of sizeof(picture)).
- >Unless I'm mistaken, did you not mean:
- >> '(photos+x)->' ?
- >To use your cordial words: 'We have enough confusion here: please refrain
- >from posting _answers_ unless you know at least the basics of C!'
-
- This is what Tanmoy gets for using a non-standard quoting technique :-)
-
- If GHouck would have invested a few neurons in the job, he would have
- realized that '(photos + x * sizeof(picture))->' was written by
- someone else and criticised by Tanmoy. This is _obvious_ if you read
- the text actually written by Tanmoy.
-
- Dan
- --
- Dan Pop
- CERN, CN Division
- Email: danpop@mail.cern.ch
- Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
-